package com.gdkm.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;


import com.gdkm.po.Drug;

@Repository
@Mapper
public interface DrugDao {
      
	 @Insert("insert into drug(drug_number,drug_name,specifications,price) "
		 		+ "values(#{drug_number},#{drug_name},#{specifications},#{price})")
		 void save1(String drug_number, String drug_name,String specifications,String price );
	
	
	@Select("SELECT * FROM drug WHERE drug_number LIKE concat('%',#{drug_number},'%') && drug_name LIKE concat('%',#{drug_name},'%') limit #{y},#{ge}")
	List<Drug> list3(String drug_number,String drug_name,int y,int ge);
	
	 @Select("SELECT * FROM drug  limit #{y},#{ge}")
	 List<Drug> list2(int y,int ge);
	 @Update("UPDATE  drug set drug_number=#{drug_number},drug_name=#{drug_name},specifications=#{specifications},price=#{price} where id=#{id}")
	 void update(Drug stu);
	 @Delete("DELETE FROM drug where id=#{id}")
		void delete1(int id);
}
